var t = getApp();

Page({
    data: {
        addressList: "",
        addressBoo: !0
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        var a = this;
        this.setData({
            addressBoo: !0
        })
        // , wx.showLoading({
        //     title: "加载中",
        //     mask: !0
        // });
        var s = this, e = wx.getStorageSync("logs") || "";
        e || wx.login({
            success: function(s) {
                var o = a, d = s.code;
                wx.request({
                    url: t.globalData.httpLogin + "user/code",
                    data: {
                        code: d,
                        token: e
                    },
                    success: function(t) {
                        var a = t.data.data.token, s = t.data.data.bindPhone;
                        if (a) {
                            o.getAddressList(a);
                            try {
                                wx.setStorageSync("logs", a);
                            } catch (t) {}
                            try {
                                wx.setStorageSync("bindPhone", s);
                            } catch (t) {}
                        }
                    },
                    fail: function(t) {}
                });
            }
        }), this.setData({
            token: e
        }), s.data.token && s.getAddressList(s.data.token);
    },
    getAddressList: function(a) {
        var s = this;
        wx.request({
            url: t.globalData.httpOne + "mall/addr/list/" + a,
            success: function(t) {
                200 == t.data.code && (null == t.data.data && s.setData({
                    addressBoo: !1
                }), wx.hideLoading(), s.setData({
                    addressList: t.data.data
                }));
            },
            fail: function() {
                wx.showToast({
                    title: "系统繁忙，请稍后重试",
                    icon: "none",
                    duration: 2e3
                });
            }
        });
    }
});